//程序入口
window.main = function ($) {
  var $btn1 = $("#btn1"),
    $btn2 = $("#btn2"),
    $btn3 = $("#btn3"),
    $btn4 = $("#btn4"),
    $ckbox = $("#ckbox"),
    $result = $("#result"),
    $state = $("#state");

  $btn1.click(function () {
    $($ckbox).prop("checked", true);
    var html = $ckbox.get(0).outerHTML;
    var state = $ckbox.get(0).checked;
    $result.text(html);
    $state.text(state);
  });
  $btn2.click(function () {
    $($ckbox).prop("checked", false);
    var html = $ckbox.get(0).outerHTML;
    var state = $ckbox.get(0).checked;
    $result.text(html);
    $state.text(state);
  });
  $btn3.click(function () {
    $($ckbox).attr("checked", "checked");
    var html = $ckbox.get(0).outerHTML;
    var state = $ckbox.get(0).checked;
    $result.text(html);
    $state.text(state);
  });
  $btn4.click(function () {
    $($ckbox).attr("checked", null);
    var html = $ckbox.get(0).outerHTML;
    var state = $ckbox.get(0).checked;
    $result.text(html);
    $state.text(state);
  });
};
